<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<?php
session_start();
if (!isset($_POST['login'])){
    echo '<form action="#" method="POST">
        <p>账号：<input type="text" name="name" id=""></p>
        <p>密码：<input type="password" name="pwd" id=""></p>
        <p><input type="submit" name="login" id="" value="登录"></p>
</form>';
}else{
    $name=$_POST["name"];
    $pwd=$_POST['pwd'];
    if ($name=='admin' && $pwd=="123456"){
        $_SESSION["name"]=$name;
        $_SESSION["pwd"]=$pwd;
        echo "登录成功,<a href='index.php'>查看个人信息</a>";
        }else{
        echo "登录错误,<a href='JavaScript:history.back()'>返回登录</a>";
    }
}
?>

</body>
</html>